using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class frm_section2Map : EntityTypeConfiguration<frm_section2>
    {
        public frm_section2Map()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.Name)
                .HasMaxLength(50);

            this.Property(t => t.template)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("frm_section2");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Order).HasColumnName("Order");
            this.Property(t => t.Page).HasColumnName("Page");
            this.Property(t => t.template).HasColumnName("template");

            // Relationships
            this.HasOptional(t => t.frm_page2)
                .WithMany(t => t.frm_section2)
                .HasForeignKey(d => d.Page);

        }
    }
}
